﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dapper.Extensions;

namespace YouWei.Infrastructure.Dto
{
    /// <summary>
    /// 车乐行-接口通用返回结果实体
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ApiCheLeXingToDisplayResponse<T>
    {
        /// <summary>
        /// 状态码，0:代表失败，1：代表成功
        /// </summary>
        public int code { get; set; }
        /// <summary>
        /// 返回信息，code为0时表错误信息，code为1时表成功信息
        /// </summary>
        public string msg { get; set; }

        /// <summary>
        /// 接口查询成功时返回的结果
        /// </summary>
        public T data { get; set; }
    }
    /// <summary>
    ///  车乐行-接口通用返回结果实体，正确返回
    /// </summary>
    /// <typeparam name="T"></typeparam>
    internal class ApiCheLeXingResponse<T>
    {
        /// <summary>
        /// 状态码，见数据字典
        /// </summary>
        public string code { get; set; }
        /// <summary>
        /// 返回信息，非空，代表错误信息；当code为正确返回码时，返回数据见data信息
        /// </summary>
        public string msg { get; set; }

        /// <summary>
        /// 接口查询成功时返回的结果
        /// </summary>
        public T data { get; set; }
    }

    #region 车乐行接口返回好像有变化，这部分先备用
    /// <summary>
    /// 车乐行-接口通用返回结果实体，错误返回
    /// </summary>
    internal class ApiCheLeXingResponse
    {
        /// <summary>
        /// 状态码，参考接口文档
        /// </summary>
        public string code { get; set; }
        /// <summary>
        /// 返回信息
        /// </summary>
        public string msg { get; set; }


    }


    /// <summary>
    /// 车乐行-行驶证接口返回
    /// </summary>
    internal class ApiCheLeXingResponseDataVehicle
    {
        /// <summary>
        /// 状态码，参考接口文档
        /// </summary>
        public string code { get; set; }
        /// <summary>
        /// data
        /// </summary>
        public ResCheLeXingVehicle msg { get; set; }

    }
    #endregion


    /// <summary>
    ///  车乐行-行驶证接口请求参数
    /// </summary>
    public class ReqCheLeXingVehicle
    {
        /// <summary>
        /// 号牌种类
        /// </summary>
        public string hpzl { get; set; }
        ///<summary>
        ///号牌号码
        ///</summary>

        public string hphm { get; set; }

        ///<summary>
        /// 所有人，可选，其他2个参数必选
        /// </summary>
        public string syr { get; set; }

    }

    /// <summary>
    /// 车乐行-行驶证接口正确时返回结果
    /// </summary>
    public class ResCheLeXingVehicle
    {
        ///<summary>
        ///号牌种类
        ///</summary>
        [Column("hpzl", "号牌种类")]
        public string hpzl { get; set; }

        ///<summary>
        ///号牌号码
        ///</summary>
        [Column("hphm", "号牌号码")]
        public string hphm { get; set; }

        ///<summary>
        ///中?品牌
        ///</summary>
        [Column("clpp1", "中?品牌")]
        public string clpp1 { get; set; }

        /////<summary>
        /////车辆型号
        /////</summary>
        //[Column("clxh", "车辆型号")]
        //public virtual string clxh { get; set; }

        ///<summary>
        ///车辆识别代号
        ///</summary>
        [Column("clsbdh", "车辆识别代号")]
        public string clsbdh { get; set; }

        ///<summary>
        ///发动机号
        ///</summary>
        [Column("fdjh", "发动机号")]
        public string fdjh { get; set; }

        ///<summary>
        ///车辆类型
        ///</summary>
        [Column("cllx", "车辆类型")]
        public string cllx { get; set; }

        ///<summary>
        ///车身颜?
        ///</summary>
        [Column("csys", "车身颜?")]
        public string csys { get; set; }

        ///<summary>
        ///使?用性质
        ///</summary>
        [Column("syxz", "使?用性质")]
        public string syxz { get; set; }

        ///<summary>
        ///机动车所有?
        ///</summary>
        [Column("syr", "机动车所有?")]
        public string syr { get; set; }

        ///<summary>
        ///初次登记日期
        ///</summary>
        [Column("ccdjrq", "初次登记日期")]
        public string ccdjrq { get; set; }

        ///<summary>
        ///检验有效期止
        ///</summary>
        [Column("yxqz", "检验有效期止")]
        public string yxqz { get; set; }

        ///<summary>
        ///强制报废期止
        ///</summary>
        [Column("qzbfqz", "强制报废期止")]
        public string qzbfqz { get; set; }

        ///<summary>
        ///机动车状态
        ///</summary>
        [Column("zt", "机动车状态")]
        public string zt { get; set; }

        ///<summary>
        ///发动机型号
        ///</summary>
        [Column("fdjxh", "发动机型号")]
        public string fdjxh { get; set; }

        ///<summary>
        ///燃料种类
        ///</summary>
        [Column("rlzl", "燃料种类")]
        public string rlzl { get; set; }

        ///<summary>
        ///排量
        ///</summary>
        [Column("pl", "排量")]
        public string pl { get; set; }

        ///<summary>
        ///功率
        ///</summary>
        [Column("gl", "功率")]
        public string gl { get; set; }

        ///<summary>
        ///轴数
        ///</summary>
        [Column("zs", "轴数")]
        public string zs { get; set; }

        ///<summary>
        ///轴距
        ///</summary>
        [Column("zj", "轴距")]
        public string zj { get; set; }

        ///<summary>
        ///前轮距
        ///</summary>
        [Column("qlj", "前轮距")]
        public string qlj { get; set; }

        ///<summary>
        ///后轮距
        ///</summary>
        [Column("hlj", "后轮距")]
        public string hlj { get; set; }

        ///<summary>
        ///总质量
        ///</summary>
        [Column("zzl", "总质量")]
        public string zzl { get; set; }

        ///<summary>
        ///整备质量
        ///</summary>
        [Column("zbzl", "整备质量")]
        public string zbzl { get; set; }

        ///<summary>
        ///核定载质量
        ///</summary>
        [Column("hdzzl", "核定载质量")]
        public string hdzzl { get; set; }

        ///<summary>
        ///核定载客
        ///</summary>
        [Column("hdzk", "核定载客")]
        public string hdzk { get; set; }

        ///<summary>
        ///出?日期
        ///</summary>
        [Column("ccrq", "出?日期")]
        public string ccrq { get; set; }

        /// <summary>
        /// 车辆型号文本，多个以“,“分隔
        /// </summary>
        public string clxhText
        {
            get
            {
                var szReturn = string.Empty;
                var type = this.GetType();
                if (type == typeof (ResCheLeXingVehicle2))
                {
                    var oRealData = this as ResCheLeXingVehicle2;
                    if (oRealData != null)
                    {
                        szReturn = string.Join(",", oRealData.clxh);
                    }
                }
                else if (type == typeof(ResCheLeXingVehicle1))
                {
                    var oRealData = this as ResCheLeXingVehicle1;
                    if (oRealData != null)
                    {
                        szReturn = oRealData.clxh;
                    }
                }
                return szReturn;
            }
        }
    }

    public class ResCheLeXingVehicle1 : ResCheLeXingVehicle
    {
        /// <summary>
        /// 车辆型号
        /// </summary>
        public string clxh { get; set; }
    }
    public class ResCheLeXingVehicle2 : ResCheLeXingVehicle
    {
        /// <summary>
        /// 车辆型号
        /// </summary>
        public List<string> clxh { get; set; }
    }
}
